<template>
  <div class="switchstyle">
      <!-- 基本属性 -->
      <el-divider content-position="left">基本属性</el-divider>
    
    <!-- 开关编辑选项 -->
    <el-form label-width="90px" label-position="left" size="small">
      <el-form-item label="默认状态">
        <el-switch v-model="datas.value"></el-switch>
      </el-form-item>
      
      <el-form-item label="文字描述">
        <el-input v-model="datas.activeText" placeholder="打开时的文字描述" style="margin-bottom: 10px;"></el-input>
        <el-input v-model="datas.inactiveText" placeholder="关闭时的文字描述"></el-input>
      </el-form-item>
      
      <el-form-item label="颜色设置">
        <div style="display: flex; align-items: center; margin-bottom: 10px;">
          <span style="width: 80px; margin-right: 10px;">打开颜色:</span>
          <el-color-picker v-model="datas.activeColor"></el-color-picker>
        </div>
        <div style="display: flex; align-items: center;">
          <span style="width: 80px; margin-right: 10px;">关闭颜色:</span>
          <el-color-picker v-model="datas.inactiveColor"></el-color-picker>
        </div>
      </el-form-item>
      
      <el-form-item label="开关宽度">
        <el-input-number v-model="datas.width" :min="20" :max="200"></el-input-number>
      </el-form-item>
      
      <el-form-item label="自定义值">
        <el-form-item label="打开值" label-width="60px">
          <el-input v-model="datas.activeValue" placeholder="打开状态的值"></el-input>
        </el-form-item>
        <el-form-item label="关闭值" label-width="60px">
          <el-input v-model="datas.inactiveValue" placeholder="关闭状态的值"></el-input>
        </el-form-item>
      </el-form-item>
      
      <el-form-item label="其他选项">
        <el-checkbox v-model="datas.disabled">禁用状态</el-checkbox>
        <el-checkbox v-model="datas.validateEvent">触发表单验证</el-checkbox>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'switchstyle',
  props: {
    datas: Object,
    'data-type': String,
  },
}
</script>

<style scoped lang="less">
.switchstyle {
  width: 100%;
  box-sizing: border-box;
  
  /* 标题 */
  h2 {
    padding: 24px 16px 24px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #f2f4f6;
    font-size: 18px;
    font-weight: 600;
    color: #323233;
  }
}
</style> 